Text reflow in a structured document

ABSTRACT

A method and computer program product for reflowing a PDL page without using the original application used to create the PDL page. The method and computer program product include receive a page represented in a page description language, the page including a plurality of page objects, and changing one or both of a size of the page and a size of one or more of the page objects, while maintaining spatial relationships between the page objects.

BACKGROUND OF THE INVENTION

The present invention relates generally to a system and method forgenerating output for computer systems, and more particularly to asystem and method for modifying the presentation of structureddocuments.

The rapid expansion of the World Wide Web—where dynamic, compellingimages are crucial—has driven the demand for a document format thatpreserves all of the fonts, formatting, colors, and graphics of anysource document, regardless of the application and platform used tocreate it.

One such format is referred to as the portable document format (PDF).PDF is a file format developed by Adobe Systems, Incorporated. PDFcaptures formatting information from a variety of desktop publishingapplications, making it possible to send formatted documents and havethem appear on the recipient's monitor or printer as they were intended.

A source document can be authored in a page description language (PDL).PDL is a language for describing the layout and contents of a printedpage. One well-known PDL is PostScript™ by Adobe Systems, Inc.PostScript describes a page in terms of page objects including textualobjects and graphical objects such as lines, arcs, and circles.Moreover, PDF is a PDL.

According to conventional methods, a PDL document is rendered by firstdefining a bounding box, such as a page, and then placing the textualand graphical objects defined for the page into the bounding boxaccording to the definitions in the PDL document. Normally the size of aPDL page is chosen so that it is clearly legible on a standardfull-sized display. For example, an 8-inch page width may be chosen fordisplay on a 15-inch computer monitor.

However, a single page size may not be ideal for devices havingnon-standard display sizes, such as a hand-held personal digitalassistant (PDA). To view a PDL page having an 8-inch page width on a3-inch-wide display, the user has two alternatives. The user can changethe zoom factor of the display to show the entire page on the 3-inchdisplay. However, this approach will generally render the page too smallto be legible. Alternatively, the user can simply show a portion of thepage at full magnification, and scroll horizontally and vertically toview the rest of the page. This approach is inconvenient andtime-consuming.

Another approach is for the author of the PDL page to generate adifferent PDL page for each display size using the application thatcreated the PDL page. This approach is wasteful because multiple copiesof each PDL page must be maintained. In addition, the user must selectthe copy that is appropriate for the display on which the PDL page willbe viewed.

SUMMARY OF THE INVENTION

In general, in one aspect, the invention features a method and computerprogram product for reflowing a PDL page without using the originalapplication used to create the PDL page. One use of the presentinvention is to resize a page for viewing on a display of a differentsize than the display to which the document was originally rendered, orto display at a different resolution, either because the inherentresolution of the display differs, or because the reader has demanded alarger, more visible representation.

In one aspect the method and computer program product include receivinga page represented in a page description language, the page including aplurality of page objects; and changing a size of the page to a changedsize in a first dimension without changing the size of the page objects,while maintaining spatial relationships between the page objects in asecond dimension.

Particular implementations can include one or more of the followingfeatures. The page objects can include textual and graphical elements,and the changing step includes maintaining spatial relationships betweenthe textual and graphical elements in the second dimension. The changingstep can further include creating one or more new pages having thechanged size in the first dimension; and adding the textual andgraphical elements to the one or more new pages. The adding step caninclude identifying distances in the second dimension between one ormore textual elements and one or more graphical elements; adding thetextual elements to the one or more new pages; and adding the graphicalelements to the one or more new pages based on the distances in thesecond dimension and positions of the textual elements in the one ormore new pages. The identifying step can include creating a mapcontaining the positions of the textual elements in the page, andaugmenting the map with the positions of the textual elements in the oneor more new pages to produce a relationship for each textual elementbetween the position of the textual element in the page and the positionof the textual element in the one or more new pages; and the step ofadding the graphical elements can include adding the graphical elementsto the one or more new pages according to the map. The step of addingthe graphical elements according to the map can include associating oneor more particular textual elements with one or more particulargraphical elements; determining distances in the second dimensionbetween the particular textual elements and the particular graphicalelements; and selecting positions in the one or more new pages forplacement of the particular graphical elements based on the distancesand the positions of the particular textual elements in the one or morenew pages as listed in the map. The associating step can includeassociating a particular graphical element with a particular textualelement that is nearest to the particular graphical element in the firstdimension. The associating step can include associating a givengraphical element with a plurality of given textual elements; and theselecting step can include scaling the given graphical element when adistance in the first dimension between the plurality of given textualelements in the page differs from a corresponding distance between theplurality of given textual elements in the one or more new pages. Thetextual elements can be organized as words.

In another aspect the method and computer program product includereceiving a page represented in a page description language, the pageincluding a plurality of page objects; and changing a size of the pageobjects without changing the size of the page, while maintaining spatialrelationships between the page objects in a dimension of the page. Thepage objects can include textual and graphical elements, and thechanging step can include maintaining spatial relationships between thetextual and graphical elements in the dimension. The changing step caninclude creating one or more new pages having the same size as the pagein a further dimension; scaling the textual and graphical elements,producing scaled textual and graphical elements; and adding the scaledtextual and graphical elements to the one or more new pages. The addingstep can include identifying distances in the dimension between one ormore textual elements and one or more graphical elements; adding thescaled textual elements to the one or more new pages; and adding thescaled graphical elements to the one or more new pages based on thedistances in the dimension and the positions of the scaled textualelements in the one or more new pages. The identifying step can includecreating a map containing the positions of the textual elements in thepage, and augmenting the map with the positions of the textual elementsin the one or more new pages to produce a relationship for each textualelement between the position of the textual element in the page and theposition of the corresponding scaled textual element in the one or morenew pages; and the step of adding the graphical elements can includeadding the graphical elements to the one or more new pages according tothe map. The step of adding the scaled graphical elements according tothe map can include associating one or more particular textual elementswith one or more particular graphical elements; determining distances inthe dimension between the particular textual elements and the particulargraphical elements; and selecting positions in the one or more new pagesfor placement of the scaled graphical elements corresponding to theparticular graphical elements based on the distances and the positionsof scaled textual elements corresponding to the particular textualelements in the one or more new pages as listed in the map. Theassociating step can include associating a particular graphical elementwith a particular textual element that is nearest to the particulargraphical element in the further dimension. The associating step caninclude associating a given graphical element with a plurality of giventextual elements; and the selecting step can include scaling the givengraphical element in the dimension when a distance in the dimensionbetween the plurality of given textual elements in the page differs froma corresponding distance in the one or more new pages between aplurality of scaled textual elements corresponding to the plurality ofgiven textual elements. The textual elements can be organized as words.

In another aspect the method and computer program product includereceiving a page represented in a page description language, the pageincluding a plurality of page objects; and changing a size of the pageto a changed size in a first dimension, and changing a size of one ormore of the page objects, while maintaining spatial relationshipsbetween the page objects in a second dimension. The page objects includetextual and graphical elements, and wherein the changing step caninclude maintaining spatial relationships between the textual andgraphical elements in the second dimension. The changing step caninclude creating one or more new pages having the same size as the pagein a further dimension; scaling the textual and graphical elements,producing scaled textual and graphical elements; and adding the scaledtextual and graphical elements to the one or more new pages. The addingstep can include identifying distances in the second dimension betweenone or more textual elements and one or more graphical elements; addingthe scaled textual elements to the one or more new pages; and adding thescaled graphical elements to the one or more new pages based on thedistances in the second dimension and positions of the textual elementsin the one or more new pages. The identifying step can include creatinga map containing the positions of the textual elements in the page, andaugmenting the map with the positions of the textual elements in the oneor more new pages to produce a relationship for each textual elementbetween the position of the textual element in the page and the positionof the corresponding scaled textual element in the one or more newpages; and the step of adding the graphical elements can include addingthe graphical elements to the one or more new pages according to themap. The step of adding the graphical elements according to the map caninclude associating one or more particular textual elements with one ormore particular graphical elements; determining distances in the seconddimension between the particular textual elements and the particulargraphical elements; and selecting positions in the one or more new pagesfor placement of the scaled graphical elements corresponding to theparticular graphical elements based on the distances and the positionsof scaled textual elements corresponding to the particular textualelements in the one or more new pages as listed in the map. Theassociating step can include associating a particular graphical elementwith a particular textual element that is nearest to the particulargraphical element in the first dimension. The associating step caninclude associating a given graphical element with a plurality of giventextual elements; and the selecting step can include scaling the givengraphical element when a distance in the dimension between the pluralityof given textual elements in the page differs from a correspondingdistance in the one or more new pages between a plurality of scaledtextual elements corresponding to the plurality of given textualelements. The textual elements can be organized as words. The amount ofsize change of a page object can depend on the type of the page object.

In general, in one aspect, the invention features a method and computerprogram product for forming illustrations in a page. It includesreceiving a page represented in a page description language (PDL), thepage including a plurality of page objects including line art elements,each page object associated with a PDL element range including at leastone PDL element; repeatedly augmenting each PDL range with a PDL elementthat is adjacent to the PDL range and is not part of another PDL rangewhen the bounding box of the PDL element overlaps the bounding box ofthe PDL object associated with the PDL range; such that the PDL elementsin each PDL range define an illustration. Particular implementations caninclude combining two illustrations when their PDL ranges are adjacentand their bounding boxes overlap.

In another aspect the method and computer program product includereceiving a page represented in a page description language (PDL), thepage including a plurality of page objects including line art elements,each page object associated with a PDL element range including at leastone PDL element; recursively coalescing line art elements havingoverlapping bounding boxes to form one or more illustrations; adding toeach illustration each PDL element within the PDL range of theillustration that is not part of the illustration when the bounding boxof the PDL element overlaps the bounding box of the illustration; andrepeatedly augmenting the PDL range of each illustration with PDLelements that are adjacent to the PDL range and are not part of anotherillustration when the bounding box of the PDL elements overlap thebounding box of the illustration; such that the PDL elements in each PDLrange define an illustration. Particular implementations can includecombining two illustrations when their PDL ranges are adjacent and theirbounding boxes overlap. The step of recursively coalescing can includecombining two line art elements having overlapping bounding boxes,thereby forming an illustration; and creating a new bounding boxcontaining the illustration. Particular implementations can includecombining a line art element with the illustration when the boundingboxes of the line art element and the illustration overlap.

Advantages that can be seen in implementations of the invention includeone or more of the following. PDL pages can be resized. A PDL pageproduced according to the invention can be legibly displayed on any sizedisplay.

The details of one or more embodiments of the invention are set forth inthe accompanying drawings and the description below. Other features andadvantages of the invention will become apparent from the description,the drawings, and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a computing system for displaying adocument.

FIG. 2 depicts a conventional PDL page.

FIG. 3 depicts a PDL page resulting from the operation of oneimplementation of the present invention.

FIG. 4 depicts a PDL page resulting from the operation of anotherimplementation of the present invention.

FIG. 5 depicts a PDL page resulting from the operation of yet anotherimplementation of the present invention.

FIG. 6 is a flowchart depicting a process for reflowing a PDL page.

FIGS. 7-10 show the results of the process of FIG. 6 when applied to aPDL page containing eleven PDL elements.

FIG. 11 depicts a process for forming illustrations.

FIG. 12 is a flowchart depicting an alternative process for formingillustrations.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

The present invention can be implemented in a raster image processor(RIP). This implementation is described with reference to FIG. 1.

FIG. 1 is a block diagram of a computing system 100 for displaying adocument. In system 100, an application 102, such as a word processor,generates a request to display a page in response to a user selection.The request is sent to an operating system 104, such as Windows™, usingan operating system call. The operating system 104 in turn directs therequest to a page description language (PDL) driver 106. The driver 106translates the operating system calls and generates a data stream thatis sent to RIP 120. RIP 120 operates to generate an encoded raster file122. The encoded raster file is sent to display device 130 for display.

The implementation described below changes only the page width, and notthe size of the page objects. In another implementation, only the sizeof the page objects is changed. In yet another implementation, both thepage width and the size of the page objects are changed. In variationsof these implementations, it is the page length that is changed, ratherthan the page width. These variations are especially useful forlanguages that are written from top to bottom, rather than from left toright. The textual elements can be organized as characters, words andthe like.

FIG. 2 shows a conventional PDL page 202. The page includes textualelements 206 and graphical elements 208 and 210. The page has a pagewidth 220. Each graphical element in a page is associated with one ormore textual elements in the page. Graphical element 208 spans severallines of text. Therefore, it is associated with two textual elements 212(“I”) and 214 (“desperate”). For convenience, textual elements 212 and214, referred to as “anchors,” are shown in bold type. Graphical element210 spans only a single line. Therefore, it is associated with a singleanchor 216 (“My”).

FIG. 3 shows a PDL page 302 after application of the reflow process ofthe present invention. The width of the original PDL page 202 is changedwhile the font size of a textual element 206 remains constant. Referringto FIGS. 2 and 3, the page width 320 of new page 302 is chosen to benarrower than the page width 220 of original page 202. Accordingly, thelength of the page increases. When referring to a PDL page, thehorizontal dimension is referred to as its X-axis and the verticaldimension is referred to as the Y-axis. Thus, it is the distance in theY-axis that increases. In this implementation, the graphical elementsare moved and stretched to follow their anchors.

The Y-axis position of anchor 216 has also increased. Therefore, theY-axis position of associated graphical element 210 is also increased sothat anchor 216 and graphical element 210 are aligned on the Y-axis. Inaddition, the Y-axis distance between anchors 212 and 214 has increased.Therefore, corresponding graphical element 208 is stretched to span thedistance between anchors 212 and 214.

FIG. 4 shows a PDL page 402 resulting from the operation of anotherimplementation of the present invention. In this implementation, thewidth of the PDL page remains constant while the font size of itstextual elements is increased. Referring to FIGS. 2 and 4, the pagewidth 420 of page 402 is the same as the page width 220 of page 202(FIG. 2). However, the font size of the textual elements 206 has beenincreased from 12 points to 14 points. Therefore, the length of the page402 is greater than the length of page 202.

The Y-axis position of anchor 216 has also increased. Therefore, theY-axis position of associated graphical element 210 is increased so thatanchor 216 and graphical element 210 are aligned on the Y-axis. Inaddition, the Y-axis distance between anchors 212 and 214 has increased.Therefore, corresponding graphical element 208 is stretched to span thedistance between anchors 212 and 214.

FIG. 5 shows a PDL page 502 resulting from the operation of anotherimplementation of the present invention. According to thisimplementation, the width of the PDL page and the font size of itstextual elements are increased. Referring to FIGS. 2 and 6/5, the pagewidth 520 of new page 502 is chosen to be narrower than the page width220 of original page 202. In addition, the font size of the textualelements 206 has been increased from 12 points to 14 points. Therefore,the length of the page 502 is greater than the length of page 202.

The Y-axis position of anchor 216 has also increased. Therefore, theY-axis position of associated graphical element 210 is increased so thatanchor 216 and graphical element 210 are aligned on the Y-axis. Inaddition, the Y-axis distance between anchors 212 and 214 has increased.Therefore, corresponding graphical element 208 is stretched to span thedistance between anchors 212 and 214.

FIG. 6 is a flowchart depicting a process for reflowing a PDL page.According to this process, only the width of the PDL page is changed.The size of the textual elements within the PDL page remains constant.In another implementation, the size of the textual elements is increasedwhile the page width is unchanged, as shown in FIG. 4. In anotherimplementation, both the page width and the font size of the textualelements are changed, as shown in FIG. 5.

A PDL page is received in step 602. The PDL page includes page objectsand including textual and graphical elements. In step 604, the processcreates a new PDL page having a page width that differs from that of thereceived original PDL page. Note that all of the implementationsmaintain the spatial relationship between the textual and graphicalelements.

In one implementation, two or more new PDL pages are created. Thetextual elements are added to the new PDL page in step 606. Nextsub-process 620 is repeated for each graphical element.

The graphical element is associated with one or more textual elements instep 608. Then the process determines a Y-axis difference between theposition of the graphical element and a position of each associatedtextual element, as shown in step 610. This step is useful when agraphical element and its associated textual element do not have thesame Y-axis position.

In one implementation, the Y-axis positions of each textual element inthe original PDL page and the new PDL page are recorded in a “Y-map.” Anexemplary Y-map is shown in Table 1. Table 1 is a Y-map between page 202of FIG. 2 and page 302 of FIG. 3. Table 1 presents the Y position in theold page (page 202) and the Y position in the new page (page 302) forthe anchor textual elements. In another implementation, the Y-maprecords positions for each textual element. Referring to Table 1, it isseen that the textual element “I ” (anchor 212) is at a Y-axis positionof 0.25 in both the old and new pages. However, the word “desperate”(anchor 214) has moved by half an inch. Similarly, the word “My” (anchor216) has moved by ¾ of an inch.

TABLE 1 Textual Element Y Position in Old Page Y Position in New Page I0.25 0.25 desperate 1.75 2.25 My 2.00 2.75

A position for the graphical element in the new page is then determinedbased on the Y-axis position of the associated textual element(s) instep 612. For example, the position of graphical element 210 in page 302is determined based on the Y-axis position of its associated textualelements (anchor 216) in page 302. Referring to the Y-map of Table 1, itis seen that the Y-axis position of anchor 216 is 2.75 inches.Therefore, assuming that the Y-axis difference between graphical element210 and anchor 216 is zero, the position for graphical element 210 inpage 302 is determined to be 2.75 inches along the Y-axis. If necessary,the graphical element is scaled (that is, stretched) in step 614. Forexample, referring to FIG. 3, graphical element 208 is stretched becauseits associated anchors 212 and 214 are further apart than in theoriginal page. Finally, the graphical element is placed at the positiondetermined in step 612, as shown in step 616.

The present invention is also useful in documents having multiplecolumns. Each column is simply treated according to the process of FIG.6 within its bounding box in the same way the PDL page 202 is treatedwithin page 302. Implementations of the present invention include threevariations to handle different multi-column cases. For example, considera two-column case with a vertical line-art element between the twocolumns. Each column has a Y-map, so there are two Y-maps. The verticalline-art element is associated with textual elements in both columns.When reflowing the line-art element, it must be decided which Y-map touse. In one implementation, the Y-map having the maximum Y value for theline-art element is used. Other implementations can be used, as would beapparent to one skilled in the relevant arts.

In a multiple column case, where a single text-line or line-art elementintersects the X-axis extent of a set of columns, that intersection isconsidered to be a “fault line.” This fault line is used as a break, sothat subsequent text (that is, text that has a greater Y-axis positionthan the fault line) is considered to be a new column.

An implementation of the present invention handles hyphenation andligatures according to the following method. The process hyphenates aword at a line-end in the new page if the original word had a softhyphen at that point. Similarly, such a word can be unhyphenated when itis no longer at a line-end in the new page. In implementations in whichthe font size of the text elements is changed, the positioning of thetext lines is addressed. In one implementation, all vertical white spaceis retained. That is, the inter-paragraph vertical gap is retained, andwithin the paragraph, the inter-line vertical gap is retained.

In the implementation discussed above, the graphical elements can besimple line art elements, images, or combinations of line art elements,images and text, such as captions. PDF documents often contain complexillustrations including multiple graphical elements, such as strokes andfills, images, and even textual elements, such as captions. Humans arevery good at identifying which components belong to a particularillustration. However, in order to successfully reflow a documentcontaining a complex illustration, it is desirable to perform thisprocess automatically. After an illustration is identified, it can bereflowed into the new page according to the process described above.

FIGS. 8-10 graphically depict combining page objects to form a singleillustration. FIG. 7 represents a PDL page containing eleven PDLelements. PDL elements E1, E2, E3, E4, E5 and E6 are line art elementsforming a “stick man” standing on the ground. PDL elements E7 and E9 areline art elements representing balloon tethers. PDL elements E8 and E10are images representing balloons. PDL element E11 is a text element thatis the caption for the drawing.

The process begins by coalescing line art elements to formillustrations. Each line art element is assigned a “bounding box.” Inthe described implementation, each bounding box is rectilinear havingsides parallel to the edges of the PDL page. Referring to FIG. 8, PDLelement E7 is enclosed by bounding box 802, and PDL element E9 isenclosed by bounding box 804.

According to the process, when line art elements have overlappingbounding boxes, they are combined to form a single illustration. Thisillustration, I2, contains the elements E7 and E9 and can be representedbyI2 =E7, E9  (1)

The drawing of FIG. 7 is represented by a sequential collection of PDLelements given by equation 1. Assume that PDL elements forming thestickman standing on the ground have already been collected to form anillustration I1 given byI1=E1, E2, E3, E4, E5, E6  (2)

The sequence of PDL elements, from first to last, associated with anillustration is referred to as its “range.” The PDL representation ofthe drawing of FIG. 7 is given below with the range of illustrations I1and I2 underlined.PDL=E1, E2, E3, E4, E8, E6, E7, E8, E9, E10, E11  (3)

Note that, although element E8 is not part of illustration I2, it fallswithin the range of illustration I2. The treatment of such “gaps” inrange is described below.

The process recursively joins line-art elements to form illustrations.Referring to FIG. 9, illustration I2 has been enclosed in bounding box902, and illustration I1 has been enclosed in bounding box 904. Becausebounding boxes 902 and 904 overlap, the process coalesces the containedline-art elements to form an illustration I3 given by equation 6.I3=E1, E2, E3, E4, E8, E6, E7, E9  (4)

The PDL range of illustration I3 then runs from E1 to E9. The PDLsequence for FIG. 9 is given below with the range of illustration I3underlined.PDL=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11  (5)

The process next seeks to fill gaps in the range such as thatrepresented by element E8. At this point, all of the line-art elementsin the PDL page have been coalesced to form illustrations. Now theprocess seeks to combine those illustrations with other PDL elementssuch as images and text. The first step of this process is to fill thegaps in the PDL ranges of the line-art illustrations. Referring to FIG.10, PDL element E8 is an image that lies within the range ofillustration I3. The process combines a PDL element with an illustrationif it lies within the PDL range of that illustration and the boundingboxes of the illustration and the PDL element overlap. Referring to FIG.10, illustration I3 has been enclosed in a bounding box 1002, and imageE8 has been enclosed within a bounding box 1004. Bounding boxes 1002 and1004 overlap. Therefore, element E8 is combined with illustration I3.Illustration I3 now combines all of the elements from E1 to E9 as shownbelow.I3=E1, E2, E3, E4, E8, E6, E7, E8, E9  (6)

The PDL representation of FIG. 10 is given below, with the range of I3underlined.PDL=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11  (7)

The process then seeks to combine PDL elements that are adjacent to therange of an illustration. A PDL element will be combined with anillustration when it is adjacent to the illustration in the PDL sequenceand the bounding boxes of the illustration and the PDL element overlap.Referring to equation 9, we see that image E10 is adjacent to the rangeof illustration I3. Referring to FIG. 10, we see the bounding box 1006of image E10 and the bounding box 1002 of illustration I3 overlap.Therefore, image E10 is combined with illustration I3. As a result,illustration I3 is given byI3=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10  (8)

The PDL representation of the drawing is then given by

 PDL=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11  (9)

Referring to equation 11, it is seen that text element E11 is adjacentto the range of illustration I3. Referring to FIG. 10, it is seen thatthe bounding box 1008 of element E11 and bounding box 1002 illustrationI3 overlap. Therefore, text element E11 is combined with illustrationI3. Illustration I3 has been given byI3=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11  (10)

The PDL range of the drawing has been given byPDL=E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11  (11)

It is seen that all of the elements within the drawing have now beencombined to form a single illustration.

FIG. 11 depicts a process for forming illustrations according to animplementation of the present invention. A PDL page is received at step1102. The PDL page includes page objects including line-art elements.The page objects can also include other sorts of PDL elements such asimages and text elements. Each page object is associated with a PDLelement range that includes at least one PDL element. It is possiblethat an illustration generated in this way is simply part of abackground. Therefore, if a page element illustration is the sane coloras the background, it is discarded in step 1103.

The line-art elements within the PDL page are recursively coalesced toform illustrations at step 1104. The first recursion includes combiningtwo line-art elements when their bounding boxes overlap to form anillustration. Following recursions include combining the illustrationand a line-art element when their bounding boxes overlap to form thenext illustration.

As described above, the range of an illustration may include PDLelements that are not part of the illustration. These PDL elementsrepresent “gaps” in the PDL range. These “gaps” are located at step1105. Each such “gap” is tested to determine whether it should be joinedwith the illustration at step 1106. A PDL element within the range of anillustration is combined with that illustration when the bounding boxesof the element and the illustration overlap.

The process then tests PDL elements that are adjacent to the ranges ofthe illustrations to determine whether they should be joined with thoseillustrations in step 1108. In one implementation, only those elementsthat are not already a part of another illustration are tested. A PDLelement that is adjacent to the range of an illustration is combinedwith that illustration when the bounding boxes of the element andillustration overlap. This step is also performed recursively to “grow”the illustrations as the range of each illustration increases.

The process then tests the illustrations to determine whether any ofthem should be joined to form a single illustration in step 1110.Illustrations are combined when their PDL ranges are adjacent and theirbounding boxes overlap.

Each PDL range that results from this process is a separateillustration. Each illustration is treated as a separate graphicalelement in the reflow process described above.

FIG. 12 is a flowchart depicting a process for forming illustrationsaccording to another implementation of the present invention. A PDL pageis received at step 1202. The PDL page includes page objects includingline-art elements. The page objects can also include other sorts of PDLelements such as images and text elements. Each page object isassociated with a PDL element range that includes at least one PDLelement.

The process then tests PDL elements that are adjacent to the ranges ofthe illustrations to determine whether they should be joined with thoseillustrations in step 1204. In one implementation, only those elementsthat are not already a part of another illustration are tested. A PDLelement that is adjacent to the range of an illustration is combinedwith that illustration when the bounding boxes of the element andillustration overlap. This step is also performed recursively to “grow”the illustrations as the range of each illustration increases.

According to one implementation, each illustration is classified fortreatment during reflow. Illustrations that lie within one line of aparagraph are classified as character surrogates. A character surrogateis an illustration that functions as a text character. Charactersurrogates are treated as text elements during reflow. Illustrationsthat lie within the bounding box of a paragraph, and which verticallyoverlap with two or more initial lines, and which are to the left of allthe characters in those lines, are classified as “illuminated letters.”Illuminated letters are reflowed at the upper left of the paragraph,with the text elements of the paragraph flowed to the right and belowthe illustration.

Illustrations that lie directly above (or below) a paragraph arereflowed to lie directly above (or below) that paragraph. Illustrationsthat do not fit within the reflow bounding box are scaled to fit withinthat bounding box.

The invention can be implemented in digital electronic circuitry, or incomputer hardware, firmware, software, or in combinations of them.Apparatus of the invention can be implemented in a computer programproduct tangibly embodied in a machine-readable storage device forexecution by a programmable processor; and method steps of the inventioncan be performed by a programmable processor executing a program ofinstructions to perform functions of the invention by operating on inputdata and generating output. The invention can be implementedadvantageously in one or more computer programs that are executable on aprogrammable system including at least one programmable processorcoupled to receive data and instructions from, and to transmit data andinstructions to, a data storage system, at least one input device, andat least one output device. Each computer program can be implemented ina high-level procedural or object-oriented programming language, or inassembly or machine language if desired; and in any case, the languagecan be a compiled or interpreted language. Suitable processors include,by way of example, both general and special purpose microprocessors.Generally, a processor will receive instructions and data from aread-only memory and/or a random access memory. Generally, a computerwill include one or more mass storage devices for storing data files;such devices include magnetic disks, such as internal hard disks andremovable disks; magneto-optical disks; and optical disks. Storagedevices suitable for tangibly embodying computer program instructionsand data include all forms of non-volatile memory, including by way ofexample semiconductor memory devices, such as EPROM, EEPROM, and flashmemory devices; magnetic disks such as internal hard disks and removabledisks; magneto-optical disks; and CD-ROM disks. Any of the foregoing canbe supplemented by, or incorporated in, ASICs (application-specificintegrated circuits).

To provide for interaction with a user, the invention can be implementedon a computer system having a display device such as a monitor or LCDscreen for displaying information to the user and a keyboard and apointing device such as a mouse or a trackball by which the user canprovide input to the computer system. The computer system can beprogrammed to provide a graphical user interface through which computerprograms interact with users.

The invention has been described in terms of particular embodiments.Other embodiments are within the scope of the following claims. Forexample, the steps of the invention can be performed in a differentorder and still achieve desirable results.

1. A computer program product, tangibly stored on a computer-readablemedium, for reflowing a page, the product comprising instructionsoperable to cause a programmable processor to: receive a pagerepresented in a page description language, the page including aplurality of columns of text positioned side-by-side on the page, eachof the plurality of columns having a width and a length, the pagefurther including a graphical element having a vertical position on thepage, adjacent to a vertical side of one of and outside each of thecolumns; for each of the plurality of columns, associate an item of textin the column with the graphical element, the item and the graphicalelement having a spatial relationship in that the item has a verticalposition corresponding to the vertical position of the graphicalelement; for at least one of the plurality of columns, change a size ofthe text, the width of the column, or both so that the relationshipbetween the size of the text and the width of the column is changed, andthen reflow text in the plurality of columns so that the item of text ineach of the columns has a new vertical position as a result of thereflow; for each of the items, calculate a change in vertical positionresulting from the reflow; and reposition the graphical element on thepage according to the new vertical position of the item of text havingthe greatest change in vertical position.
 2. The product of claim 1,wherein the graphical element has a vertical extent defined by an uppervertical position and a lower vertical position, the vertical positionof one of the items corresponds to the upper vertical position, and theitem is a first item, the product further comprising instructions to:associate, with the graphical element, a second item of text in thecolumn of the first item, the second item having, before the reflow, avertical position corresponding to the lower vertical position, thesecond item having a new vertical position as a result of the reflow;and scale the graphical element, the scaling being based on the newvertical position of the first item and the second item.
 3. The productof claim 2, wherein instructions to scale include instructions to scalein the vertical direction.
 4. The product of claim 2, furthercomprising: define a map that indicates a change in vertical positionsof the first and second items, the change resulting from the reflow, themap indicating pre-reflow and post-reflow vertical positions of thefirst and second items.
 5. The product of claim 1, further comprisinginstructions to: identify columns that are positioned top-to-bottom andseparated by line art as separate columns when reflowing text.
 6. Theproduct of claim 1, further comprising instructions to: insert a hyphenat the end of a line of text when the word at the end was separated byreflow and there is a soft hyphen at the position where the hyphen is tobe insert; and maintain a hyphen in a word when the word is no longerseparated.
 7. The product of claim 1, further comprising instructionsto: replicate ligatures when reflowing text.
 8. The product of claim 1,wherein: the graphical element is line art.
 9. The product of claim 1,wherein: at least one of the item, of text is one of a character or aword.
 10. A method for reflowing a page, comprising: electronicallyreceiving a page represented in a page description language, the pageincluding a plurality of columns of text positioned side-by-side on thepage, each of the plurality of columns having a width and a length, thepage further including a graphical element having a vertical position onthe page, adjacent to a vertical side of one of and outside each of thecolumns; for each of the plurality of columns, associating an item oftext in the column with the graphical element, the item and thegraphical element having a spatial relationship in that the item has avertical position corresponding to the vertical position of thegraphical element; for at least one of the plurality of the columns,changing a size of the text, the width of the column, or both so thatthe relationship between the size of the text and the width of thecolumn is changed, and then reflowing text in the plurality of columnsso that the item of text in each of the columns has a new verticalposition as result of the reflow; for each of the, items calculating achange in vertical position resulting from the reflow; and repositioningthe graphical element on the page according to the new vertical positionof the item of text having the greatest change in vertical position. 11.The method of claim 10, wherein the graphical element has a verticalextent defined by an upper vertical position and a lower verticalposition, the vertical position of one of the items corresponds to theupper vertical position, and the item is a first item, the methodfurther comprising: associating, with the graphical element, a seconditem of text in the column of the first item, the second item having,before the reflow, a vertical position corresponding to the lowervertical position, the second item having a new vertical position as aresult of the reflow; and scaling the graphical element, the scalingbeing based on the new vertical position of the second item.
 12. Themethod of claim 11, wherein scaling includes scaling in the verticaldirection.
 13. The method of claim 11, further comprising: defining amap that indicates a change in vertical positions of the first andsecond items of text, the change resulting from the reflow, the mapindicating pre-reflow and post-reflow vertical positions of the firstand second items.
 14. The method of claim 10, further comprising:identifying columns that are positioned top-to-bottom and separated byline art as separate columns when reflowing text.
 15. The method ofclaim 10, further comprising: inserting a hyphen at the end of a line oftext when the word at the end was separated by reflow and there is asoft hyphen at the position where the hyphen is to be insert; andmaintaining a hyphen in a word when the word is no longer separated. 16.The method of claim 10, further comprising: replicating ligatures whenreflowing text.
 17. The method of claim 10, wherein: the graphicalelement is line art.
 18. The method of claim 10, wherein: at least oneof the items of text is one of a character or a word.
 19. The product ofclaim 1, wherein: the page is one of a page in a structured document, apage in a PDF document, or a page represented in the PostScript pagedescription language.
 20. The method of claim 10, wherein: receiving apage includes receiving one of a page in a structured document, a pagein a PDF document or a page represented in the PostScript pagedescription language.